<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Module trader</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
</head>
<body bgcolor="white">
<div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<hr>

<h1>Module trader</h1>
<ul class="index"><li><a href="#description">Description</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>The trader module keeps track of all usable harbors and given a resource hand it calculate all possible hands with the use of trades.


<h2><a name="description">Description</a></h2>The trader module keeps track of all usable harbors and given a resource hand it calculate all possible hands with the use of trades
<h2><a name="index">Function Index</a></h2>
<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#getTrades-3">getTrades/3</a></td><td> Given a hand of resources getTrades calculates all possible hands with the use of trade with the bank.</td></tr>
<tr><td valign="top"><a href="#init-0">init/0</a></td><td>starts the trader as a new process.</td></tr>
<tr><td valign="top"><a href="#makeTrade-3">makeTrade/3</a></td><td> Calculates what resources to get and what to trade away, given two resource list.</td></tr>
<tr><td valign="top"><a href="#trader-3">trader/3</a></td><td> The main function of the trader agent, keeps track of usable harbors and makes trades with the bank.</td></tr>
</table>

<h2><a name="functions">Function Details</a></h2>

<h3 class="function"><a name="getTrades-3">getTrades/3</a></h3>
<div class="spec">
<p><tt>getTrades(Cards::[{atomic, Integer}], ThreeOne::boolean, TwoOnes::[{atomic, Integer}]) -&gt; [[{atomic, Integer}]]</tt></p>
</div><p> Given a hand of resources getTrades calculates all possible hands with the use of trade with the bank</p>

<h3 class="function"><a name="init-0">init/0</a></h3>
<div class="spec">
<p><tt>init() -&gt; PID</tt></p>
</div><p>starts the trader as a new process</p>

<h3 class="function"><a name="makeTrade-3">makeTrade/3</a></h3>
<div class="spec">
<p><tt>makeTrade(Res::[{atomic, Integer}], NewRes::[{atomic, Integer}], PMPid::PID) -&gt; ok</tt></p>
</div><p> Calculates what resources to get and what to trade away, given two resource list. The result is sent to PMPid, msg:parse_message</p>

<h3 class="function"><a name="trader-3">trader/3</a></h3>
<div class="spec">
<p><tt>trader(ThreeOne, TwoOnes, IDs) -&gt; any()</tt></p>
</div><p> The main function of the trader agent, keeps track of usable harbors and makes trades with the bank.</p>
<hr>

<div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<p><i>Generated by EDoc, May 20 2011, 17:27:19.</i></p>
</body>
</html>
